﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_Default" MasterPageFile="~/MasterPage.master" %>

<asp:Content ID="main" ContentPlaceHolderID="main" runat="server">
    <div class="col-md-7">
        <div class="page-header">
        <h1>使弱者得到保护，使强者得到公正</h1>
        <h1>使每个人感到公平公正</h1>
            </div>
    </div>
    <div class="col-md-5">
        <div class="panel panel-default">
            <div class="panel-body">
                <div class="form-group">
                    <label for="exampleInputEmail1">账号</label>
<%--                     <p class="form-control-static">pengbd3</p>--%>
                    <input type="text" class="form-control" id="Username" placeholder="Enter Name" role="tooltip" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="用户名必须是有效的邮件地址" />
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">密码</label>
                    <input type="password" class="form-control" id="Password" placeholder="Password" role="tooltip" data-toggle="popover" data-trigger="focus" data-placement="top" data-content="请输入合法、有效的密码" />
                </div>
                <a href="#">忘记密码？</a>
                <button id="btn_login" type="button" class="btn btn-success btn-lg btn-block">登录</button>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="js" ContentPlaceHolderID="footerJS" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btn_login").click(function () {
                login();
            });
        });
        function login() {
            $.ajax({
                type: "POST",
                url: "ajax/Login.ashx",
                data: { 'UserName': $("#Username").val(), 'PassWord': $("#Password").val() },
                datatype: "text/json",
                beforeSend: function () {
                    $('#btn_login').text('登录中...').attr({ disabled: 'disabled' });
                },
                success: function (msg) {
                    if (msg == "1") {
                        window.location.href = "../admin/Config.aspx";
                    }
                    else {
                        alert('登录失败！');
                    }
                },
                complete: function (data) {
                    $('#btn_login').text('登录').removeAttr("disabled");
                }
            });
        }
    </script>
</asp:Content>